package com.compmov.socialnetwork;

import java.util.List;

import android.app.Activity;
import android.os.Bundle;
import android.widget.ListView;
import android.widget.Toast;

import com.compmov.datamodel.Solicitud;
import com.compmov.libraries.SolicitudesAdapter;
import com.compmov.webservice.SolicitudWSClient;
import com.compmov.webservice.WSClientException;

public class Solicitudes extends Activity {
	private ListView list;
	SolicitudesAdapter adapter;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.solicitudes);
		
		list = (ListView) findViewById(R.id.list);
		SolicitudWSClient solicitudWS = new SolicitudWSClient("solicitud");
		try{
			List<Solicitud> solicitudes=solicitudWS.getSolicitudes(com.compmov.libraries.Utils.getPersona());
			adapter = new SolicitudesAdapter(this, solicitudes);
			list.setAdapter(adapter);
		
		} catch (WSClientException e) {
			Toast.makeText(getBaseContext(),"Error en el servidor. Intente de nuevo",
					Toast.LENGTH_SHORT).show();
		}

	}

	@Override
	public void onDestroy() {
		adapter.imageLoader.stopThread();
		list.setAdapter(null);
		super.onDestroy();
	}



	private String[] mStrings = {
			"http://a3.twimg.com/profile_images/670625317/aam-logo-v3-twitter.png",
			"http://a3.twimg.com/profile_images/740897825/AndroidCast-350_normal.png",
			"http://a1.twimg.com/profile_images/655119538/andbook_normal.png",
			"http://a3.twimg.com/profile_images/511790713/AG_normal.png",
			"http://a3.twimg.com/profile_images/956404323/androinica-avatar.png",
			"http://a3.twimg.com/profile_images/768060227/ap4u_normal.jpg",
			"http://a1.twimg.com/profile_images/74724754/android_logo.png",
			"http://a3.twimg.com/profile_images/681537837/SmallAvatarx150_normal.png",
			"http://a1.twimg.com/profile_images/612232882/nexusoneavatar_normal.jpg",
			"http://a1.twimg.com/profile_images/213722080/Bugdroid-phone_normal.png",
			"http://a1.twimg.com/profile_images/645523828/OT_icon_090918_android.png",
			"http://a3.twimg.com/profile_images/64827025/android-wallpaper6_2560x160_normal.png",
			"http://a3.twimg.com/profile_images/77641093/AndroidPlanet_normal.png" };


}
